<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../jQuery/js/jquery-1.12.4.min.js"></script>
    <script>
        $(function(){
            var $li1 = $('li');
            $li1.click(function(){
                // 原生Js写法
                // this.style.color='red';
                $(this).css({color:'red'})
                alert($(this).index())
            })
            $('#btn1').click(function(){
                // 获取文本框的值
                alert($('#txt1').val())
            })
            $('#txt1').focus(function(){
                $(this).css({background:'green'});
            })
            $('#txt1').blur(function(){
                $(this).css({background:'red'})
            })
            $('#txt1').mouseover(function(){
                $(this).css({background:'gray'})
            })
        })
    </script>
</head>
<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
    <input type="text" id='txt1'>
    <input type="button" value="点我" id='btn1'>
</body>
</html>